package cn.gs.system.service.impl;

import cn.gs.common.service.BaseService;
import cn.gs.common.service.BaseServiceImpl;
import cn.gs.system.entity.User;
import cn.gs.system.mapper.UserMapper;
import cn.gs.system.service.UserService;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author gs
 * @date 2020/1/10
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;


    @Override
    public User findByName(String username) {
        Example example = new Example(User.class);
        example.createCriteria().andCondition("username=",username);
        List<User> list = userMapper.selectByExample(example);
        return list.isEmpty() ? null :list.get(0);
    }
}
